//
//  RecommendMenuView.swift
//  MyTest
//
//  Created by guanzhongwang on 2021/5/18.
//

import UIKit

class RecommendMenuView: UIView {
    private var menuTap:(()->Void)!
    var title:String!
    var point:(Int,Int)!
    init(title:String,point:(Int,Int),tap:@escaping (()->Void)) {
        super.init(frame: .zero)
        self.point = point
        self.title = title
        self.menuTap = tap
        setRadiusAndDirection(radius: 5)
        setBorder(1, color: Separator_COLOR)
        backgroundColor = .white
        let titleLabel = UILabel()
        addSubview(titleLabel)
        titleLabel.font = Font_Size_14
        titleLabel.text = title
        titleLabel.textColor = B000_COLOR
        titleLabel.snp.makeConstraints({
            $0.center.equalToSuperview()
        })
        addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(buttonTap)))
        let icon = UIImageView()
        icon.image = UIImage(named: "add")
        addSubview(icon)
        icon.snp.makeConstraints({
            $0.right.equalToSuperview()
            $0.top.equalTo(0)
            $0.size.equalTo(CGSize.init(width: 15, height: 15))
        })
        
    }
    @objc func buttonTap(){
        menuTap()
    }
    required init?(coder: NSCoder) {
        fatalError()
    }
}
